import data from '@ohos.telephony.data';

export class TimeGetter {
  static getNowDate(): string {
    const date = new Date();
    let month: string | number = date.getMonth() + 1;
    let strDate: string | number = date.getDate();
    let minute: string | number = date.getMinutes();


    if (month <= 9) {
      month = "0" + month;
    }

    if (strDate <= 9) {
      strDate = "0" + strDate;
    }

    if (minute <= 9) {
      minute = "0" + minute;
    }


    // console.log(date.getFullYear() + "-" + month + "-" + strDate + " " + date.getHours() + ":" + minute + ":" + date.getSeconds() + date.getDay())
    return date.getFullYear() + "-" + month + "-" + strDate + " " + date.getHours() + ":" + minute + ":" + date.getSeconds();
  }

  static getNowDay(): string {
    const date = new Date();
    let day = date.getDay();
    let result = ""
    if(day == 1) result = "一"
    if(day == 2) result = "二";
    if(day == 3) result = "三";
    if(day == 4) result = "四";
    if(day == 5) result = "五";
    if(day == 6) result = "六";
    if(day == 7) result = "日";

    // console.log(result)
    return result;
  }
}